from docx2pdf import convert
from pdf2docx import Converter


# Word转PDF
def convert_word_to_pdf(word_path, pdf_path):
    convert(word_path, pdf_path)


# PDF转Word
def convert_pdf_to_word(pdf_path, docx_path):
    # 创建 Converter 对象
    cv = Converter(pdf_path)
    # 执行转换
    cv.convert(docx_path)
    # 关闭 Converter 对象
    cv.close()


# 调用函数进行转换
word_file = r"C:\Users\MyJin\Desktop\ZW-00040非常好用的免费简历模板.docx"
pdf_file = r"C:\Users\MyJin\Desktop\ZW-00040非常好用的免费简历模板.pdf"
convert_word_to_pdf(word_file, pdf_file)

print("转换成功")
